'use strict';

angular.module('bjggApp')
  .service('$user', function ($http) {
        return {
            // 搜索用户
            searchUser:function(name,callback){
                // $http.get('/api/vote/illegalAccess')
                // .success(function(data,status,headers,config){
                //     return callback(data);
                // });
                var data = [{id:'1',name:'zhangsan'}];
                return callback(data);
            },
            // 创建用户
            createUser:function(name){
                $http.post('/path/xxxx',{name:name}).success(function(data,status,headers,config){
                        console.log('数据添加成功');
                });
            },
            // 初始化数据
            initializeData:function(callback){
                $http.get('/path/abc').success(function(data,status,headers,config){
                    var data = [
                    {id:'1',name:'zhangsan1'},
                    {id:'2',name:'zhangsan2'},
                    {id:'3',name:'zhangsan3'},
                    {id:'4',name:'zhangsan4'},
                    {id:'5',name:'zhangsan5'},
                    ];
                        return callback(data);
                });
            }
        };
    
  });